﻿using System.Collections.Generic;
using IceDog.DNF.Program.WebApi2.Models;

namespace IceDog.DNF.Program.WebApi2.Repository
{
    /// <summary>
    /// 产品仓库接口
    /// </summary>
    public interface IProductRepository
    {
        /// <summary>
        /// 获取所有产品
        /// </summary>
        /// <returns>返回产品列表</returns>
        IEnumerable<Product> GetAllProducts();
        /// <summary>
        /// 根据id获取产品
        /// </summary>
        /// <param name="id">产品编号</param>
        /// <returns>返回对应id的产品</returns>
        Product GetProductById(int id);
        /// <summary>
        /// 根据分类获取产品
        /// </summary>
        /// <param name="category">产品分类</param>
        /// <returns>返回对应id的产品</returns>
        IEnumerable<Product> GetProductByCategory(string category);
        /// <summary>
        /// 添加产品
        /// </summary>
        /// <param name="product">产品对象</param>
        /// <returns>添加的产品</returns>
        Product AddProduct(Product product);
        /// <summary>
        /// 移除产品
        /// </summary>
        /// <param name="id">产品编号</param>
        /// <returns>是否移除成功</returns>
        bool RemoveProduct(int id);
        /// <summary>
        /// 更新产品
        /// </summary>
        /// <param name="id">产品编号</param>
        /// <param name="product">产品对象</param>
        /// <returns>是否更新成功</returns>
        bool UpdateProduct(int id, Product product);
    }
}
